package com.nord.Menus;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.Button;

import com.nord.R;
import com.nord.NewsList.NewsFeed;
import com.nord.WebTools.HtmlBrowser;

public class VisnaNord extends Activity{
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_visna_nord);

		Button menuBanner = (Button) findViewById(R.id.menuBanner);
		Typeface tf = Typeface.createFromAsset(getAssets(), "DaysOne-Regular.ttf");
		menuBanner.setTypeface(tf);

		new LoadVisnaNord().execute();
	}
	
	private class LoadVisnaNord extends AsyncTask<Void, Integer, Void> {
		ProgressDialog progressBar;

		@Override
		protected void onPreExecute() {
			super.onPreExecute();
			progressBar = new ProgressDialog(VisnaNord.this);
			progressBar.setCancelable(false);
			progressBar.setMessage("Er að sækja vísur...");
			progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
			progressBar.setProgress(0);
			progressBar.setMax(100);
			progressBar.show();
		}
		
		@Override
		protected Void doInBackground(Void... params){
			return null;
		}
		
		@Override
		protected void onPostExecute(Void v) {
			progressBar.dismiss();
			
			try {
				WebView webview = (WebView) findViewById(R.id.webView1);
				webview.loadUrl("file:///android_asset/visnanord.html");
			} catch (Exception e) {
				System.out.println("ble");
				e.printStackTrace();
			}
		}
	}
}
